class ToolongMyEcception(Exception):
    def __init__(self,long):
        '''

        :param long: 长度
        '''
        self.len=long
        pass
    def __str__(self):
        return '您输入的姓名长度是'+str(self.len)+'超过长度了..'
    pass
def name_Test():
    name=input('请输入姓名...')
    try:
        if len(name)>5:
            raise ToolongMyEcception(len(name))#手动抛出一个异常
        else:
            print(name)
            pass
        pass
    except ToolongMyEcception as result:
        print(result)
        pass
    finally:
        print('执行完毕了')

name_Test()


